package com.example.bootweb.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.server.Session;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Slf4j
@RestController
public class IndexController {

    @Value("${server.port}")
    String port;

    @RequestMapping("/")
    public String index(HttpServletRequest request){
        HttpSession session = request.getSession();
        session.getId();
        return port+"        "+session.getId();
    }
}
